<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <!-- 理想视口的标准的写法 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>公共样式</title>
    <link rel="stylesheet" href="../css/base.css ">
    <link rel="stylesheet" href="../lib/assets/css/amazeui.css">
    <link rel="stylesheet" href="../css/public.css">
    <link rel="stylesheet" href="../css/goodsList.css">

</head>

<body>
    <!-- 头部 -->
    <header>
        <a href="#" class="header_logo ">
            <img src="../images/header_logo.png" alt="">
        </a>
        <a href="#" class="header_app">
            <img src="../images/header_app.png" alt="">
        </a>
    </header>
    <!-- 搜索框 -->
    <div class="search">
        <input type="text" class="search_text" placeholder="请输入你想比价的商品">
        <input type="button" class="search_btn" value="搜索">
    </div>
    <!-- 内容部分 -->
    <div class="content">
        <div class="content_title">
            <!-- <a href="#">首页</a>
            >
            <a href="#">全部分类</a>
            >
            <a href="#">电视</a>
            <span>筛选</span> -->
        </div>
        <div class="content_main">
            <ul id="contentList">
                <!-- <li>
                    <div class="goods">
                        <a href="javascript:;"><img src="http://img2014.zuyushop.com/ProPic/201412/Thumb/Thumb_2014120015214690353.jpg" alt="奥克斯(AUX) KFR-25GW/FK01+3 1匹 挂壁式定速冷暖空调" width="100" height="100"></a>
                       <div class="rightPart">
                        <a href="javascript:;" class="title">奥克斯(AUX) KFR-25GW/FK01+3 1匹 挂壁式定速冷暖空调</a>
                        <span class="rmb">￥1499.00</span>
                        <div class="bottom_part">
                            <a href="#">报价</a>
                            <a href="#">评价</a>
                        </div>
                       </div>
                    </div>
                </li> -->
            </ul>
        </div>
    </div>
    <!-- 分页部分 -->
    <div class="goodsListPage">
        <ul data-am-widget="pagination" class="am-pagination am-pagination-select">


            <li class="am-pagination-prev ">
                <a href="javascript:;" class="">上一页</a>
            </li>


            <li class="am-pagination-select">
                <select>
                    <option value="#" class="" id="pageCount">
                    </option>
                    <!-- <option value="#" class="">2 /
                    </option>
                    <option value="#" class="">3 /
                    </option> -->
                </select>
            </li>


            <li class="am-pagination-next ">
                <a href="javascript:;" class="">下一页</a>
            </li>

        </ul>
    </div>
    <!-- 底部 -->
    <div class="foot_mod">
        <div class="foot_top">
            <a href="#">登录</a> <a href="#">注册</a>
            <a href="#top" style="width: 40%; border: 0;">
                <img src="http://www.zuyushop.com/wap/images/top.jpg" width="15" height="15">返回顶部</a>
        </div>
        <div class="footer">
            <p>
                <a href="#">手机app下载</a>
                <a href="#">慢慢买手机版</a>
                -- 掌上比价平台
            </p>
            <p>
                m.manmanbuy.com
            </p>
        </div>
    </div>
    <!-- 返回顶部 -->
    <div data-am-widget="gotop" class="am-gotop am-gotop-default">
        <a href="#top" title="回到顶部">
            <span class="am-gotop-title">回到顶部</span>
            <i class="am-gotop-icon am-icon-chevron-up"></i>
        </a>
    </div>

</body>

</html>
<!-- <script src="../lib/assets/js/amazeui.js"></script> -->
<script type="text/template" id="goodsListTitleTpl">
    {{each arr val key}}
    <a href="../index.html">首页</a>
    >
    <a href="./category.html">全部分类</a>
    >
    <a href="javascript:;">{{val.category}}</a>
    <span>筛选</span>
    {{/each}}
</script>
<script type="text/template" id="goodsListcontentTpl">
    {{each arr val key}}
    <li>
        <div class="goods">
            <a href="./product_info.html?productid={{val.productId}}">{{@ val.productImg}}</a>
           <div class="rightPart">
            <a href="./product_info.html?productid={{val.productId}}" class="title">{{val.productName}}</a>
            <span class="rmb">{{val.productPrice}}</span>
            <div class="bottom_part">
                <a href="#">{{val.productQuote}}</a>
                <a href="#">{{val.productCom}}</a>
            </div>
           </div>
        </div>
    </li>
    {{/each}}
</script>
<script src="../lib/arttemplate/template-web.js"></script>
<script src="../lib/zepto/zepto.js"></script>
<script src="../js/goodsList.js"></script>
<!-- <script>
    function GetRequest() {
        //获取url中"?"符后的字串  
        var url = location.search;
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }
    var obj = GetRequest();
    var thisPage = 1;
    var totalPage;
    var categoryId = obj.categoryid;
    // console.log(categoryId);
    $.get("http://193.112.55.79:9090/api/getcategorybyid", { "categoryid": categoryId }, function (res) {
        // console.log({arr:res.result});
        var html = template("goodsListTitleTpl", { arr: res.result });
        $('.content_title').html(html);
    })
    render();

    $('.am-pagination-next').on('tap',function(){
        thisPage+=1;
        render();
    })
    $('.am-pagination-prev').on('tap',function(){
        thisPage-=1;
        render();
    })
    function render() {
        $.get("http://193.112.55.79:9090/api/getproductlist", { "categoryid": categoryId, "pageid": thisPage }, function (res) {
            // console.log(res.totalCount);
            // console.log(res.pagesize);
            totalPage = Math.ceil(res.totalCount/res.pagesize);
            var html = template("goodsListcontentTpl", { arr: res.result });
            $('#contentList').html(html);
            $('#pageCount').html(thisPage + "/" +totalPage);
        })
    }
  
</script> -->